<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>通知公告管理</title>
	<script type="text/javascript">
		$(document).ready(function() {
			layui.use('table', function(){
				let table = layui.table;
				table.init('layui-filter-table1',{
					escape : false
					,height: getLayuiTableHeight()
					,className: 'layui-table-custom'
					,done: function (res,curr,count){
					}
				});
			});
		});
	</script>
</head>
<body>
<div class="content">
	<sys:message content="${message}"/>
	<div class="card">
		<form:form id="searchForm" class="form-inline"
				   modelAttribute="sysNotice" method="post"
				   action="${ctxAdmin}/sys/sysNotice/" >
			<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
			<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>

			<div class="input-group input-group-sm">
				<div class="input-group-prepend">
					<span class="input-group-text">名称</span>
				</div>
				<form:input path="name" htmlEscape="false" maxlength="255" class="form-control"/>
			</div>
			<div class="input-group input-group-sm">
				<div class="input-group-prepend">
					<span class="input-group-text">内容</span>
				</div>
				<form:input path="content" htmlEscape="false" class="form-control"/>
			</div>
			<div class="input-group input-group-sm">
				<div class="input-group-prepend">
					<span class="input-group-text">类型</span>
				</div>
				<form:input path="type" htmlEscape="false" maxlength="1" class="form-control"/>
			</div>
			<div class="btn-group btn-group-sm ml-1">
				<button id="btnSubmit" type="submit" class="btn btn-primary " onclick="return page();">查询</button>
				<button id="btnReset" type="button" class="btn btn-primary" onclick="resetForm();page();">重置</button>
			</div>
		</form:form>

		<div id="optButtonGroup" class="p-1">
			<shiro:hasPermission name="sys:sysNotice:edit">
				<button class="btn btn-sm btn-outline-primary" onclick="popupLayerLeft('新增',$(this).data('url'))"
				   		data-url="${ctxAdmin}/sys/sysNotice/form">
					<i class="icon-database-add mr-2"></i>新增</button>
				<button class="btn btn-sm btn-outline-primary" onclick="confirmUpdate(this,'layui-table-id1','更新数据')"
						data-url="${ctxAdmin}/sys/sysNotice/form?id=">
					<i class="icon-database-edit2 mr-2"></i>修改</button>
				<button class="btn btn-sm btn-outline-danger" onclick="batchConfirmOperation(this,'layui-table-id1','确认删除吗？')"
						data-url="${ctxAdmin}/sys/sysNotice/delete?ids=">
					<i class="icon-database-remove mr-2"></i>删除</button>
			</shiro:hasPermission>
		</div>
		<table id="layui-table-id1" lay-filter="layui-filter-table1" style="display: none;">
			<thead>
				<tr>
					<th lay-data="{field:'numbers',type: 'numbers',align:'center',width:40, fixed: 'left'}">#</th>
					<th lay-data="{field:'checkbox',type: 'checkbox', fixed: 'left'}"></th>
					<th lay-data="{field:'id',hide:true}">ID</th>
					<th lay-data="{field:'a.name'}">名称</th>
					<th lay-data="{field:'a.file_id'}">附件</th>
					<th lay-data="{field:'a.show_date',align:'center',width:100}">显示日期</th>
					<th lay-data="{field:'a.update_date',align:'center',width:130}">更新时间</th>
				</tr>
			</thead>
			<tbody>
			<c:forEach items="${page.list}" var="sysNotice">
				<tr>
					<td></td>
					<td></td>
					<td>${sysNotice.id}</td>
					<td>${sysNotice.name}</td>
					<td>
						<span>${sysNotice.sysFile.fileName}</span>
						<a href="${ctxAdmin}/sys/sysFile/download?id=${sysNotice.sysFile.id}" class="btn btn-outline alpha-primary text-primary">下载</a>
						<c:if test="${sysNotice.sysFile.fileExt eq 'pdf'}">
							<a href="#" onclick="popupLayerFull(this,'文件预览')" class="btn btn-outline alpha-primary text-primary"
							   data-url="${ctxAdmin}/sys/sysFile/preview?id=${sysNotice.sysFile.id}">预览</a>
						</c:if>
					</td>
					<td><fmt:formatDate value="${sysNotice.showDate}" pattern="yyyy-MM-dd"/></td>
					<td><fmt:formatDate value="${sysNotice.updateDate}" pattern="yyyy-MM-dd HH:mm"/></td>
				</tr>
			</c:forEach>
			</tbody>
		</table>
		<sys:laypage page="${page}"/>
	</div>
</div>
</body>
</html>